package source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * Source 读取数据源 生成DataStream或者DataSet
 * base source
 * socket source 受限于socket 并行度为1
 * collection
 * custom
 */
public class TextFileSourceDemo {

    public static void main(String[] args) throws Exception {
        // 创建Flink程序执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        // 使用textFile读取创建Source
        // 读取完文件之后程序就会自动停止
        DataStreamSource<String> text = env.readTextFile("C:\\Users\\14461\\Desktop\\flink\\flink_java\\data\\input1\\1.txt");

        // 打印
        text.print();

        // 执行
        env.execute("read text");
    }
}
